home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / JFC.bin / ListModel.java < prev    next >
Text File  |  1998-06-30  |  2KB  |  66 lines

  1. /*
  2.  * @(#)ListModel.java    1.7 98/01/30
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20.  
  21. package com.sun.java.swing;
  22.  
  23. /**
  24.  * This interface defines the methods components like JList use 
  25.  * to get the value of each cell in a list and the length of the list.
  26.  * Logically the model is a vector, indices vary from 0 to
  27.  * ListDataModel.getSize() - 1.  Any change to the contents or
  28.  * length of the data model must be reported to all of the
  29.  * ListDataListeners.
  30.  *
  31.  * @version 0.0 03/01/97
  32.  * @author Hans Muller
  33.  * @see JList
  34.  */
  35.  
  36. import com.sun.java.swing.event.ListDataListener;
  37.  
  38.  
  39. public interface ListModel
  40. {
  41.   /** 
  42.    * Returns the length of the list.
  43.    */
  44.   int getSize();
  45.  
  46.   /**
  47.    * Returns the value at the specified index.  
  48.    */
  49.   Object getElementAt(int index);
  50.  
  51.   /**
  52.    * Add a listener to the list that's notified each time a change
  53.    * to the data model occurs.
  54.    * @param l the ListDataListener
  55.    */  
  56.   void addListDataListener(ListDataListener l);
  57.  
  58.   /**
  59.    * Remove a listener from the list that's notified each time a 
  60.    * change to the data model occurs.
  61.    * @param l the ListDataListener
  62.    */  
  63.   void removeListDataListener(ListDataListener l);
  64. }
  65.  
  66.